import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ViewController } from 'ionic-angular';
import { ApiProvider } from '../../../providers/api/api';
import { NotificationProvider } from '../../../providers/notification/notification';

/**
 * Generated class for the StoreEditPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-store-edit',
  templateUrl: 'store-edit.html',
})
export class StoreEditPage {
  private item: any;

  constructor(public navCtrl: NavController,
    public navParams: NavParams,
    private api: ApiProvider,
    private notification: NotificationProvider,
    private viewCtrl: ViewController) {
    this.item = navParams.get('item'); //页面之间的传值
  }

  ionViewDidLoad() {
    this.notification.hideLoading();
  }
  
  dismiss() {
    this.item.sp_store__out_money = this.item.sp_store__out_num * this.item.sp_store__out_price || 0;  //计算金额
    this.viewCtrl.dismiss(this.item);
  }
}